<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<form class="layui-form" action="" lay-filter="manager_product_filter">
	<input type="hidden" name="rowId">
	<input type="hidden" name="proPhoto" id="photo">
	<div class="layui-form-item">
		<label class="layui-form-label">产品类型</label>
		<div class="layui-input-block">
			<div class="layui-inline">
				<select name="interest" lay-filter="catalog1-filter" id="catalog1">
					<c:forEach items="${catalogList}" var="catalog">
						<option value="${catalog.rowId}">${catalog.catalogName}</option>
					</c:forEach>
				</select>
			</div>
			<div class="layui-inline">
				<select name="catalogId" lay-filter="catalog2-filter" id="catalog2">
				</select>
			</div>
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">产品上架</label>
		<div class="layui-input-block">
			<input type="checkbox" checked="" name="proON" lay-skin="switch" lay-filter="switchTest" lay-text="上架|下架" value="1">
		</div>
	</div>
	<div class="layui-upload" style="position: absolute; top: 100px; right: 240px;">
		<button type="button" class="layui-btn" id="test1">上传图片</button>
		<div class="layui-upload-list">
			<img class="layui-upload-img" id="demo1"  style="width:150px;height:150px">
			<p id="demoText"></p>
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">产品名称</label>
		<div class="layui-input-block">
			<div class="layui-inline">
				<input type="text" name="proName" lay-verify="required" placeholder="请输入产品名称" autocomplete="off" class="layui-input">
			</div>
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">产品数量</label>
		<div class="layui-input-block">
			<div class="layui-inline">
				<input type="text" name="proNumber" id="userUsername" lay-verify="required" placeholder="请输入产品数量" autocomplete="off" class="layui-input">
			</div>
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">产品价格</label>
		<div class="layui-input-block">
			<div class="layui-inline">
				<input type="text" name="proPrice" lay-verify="required|number" placeholder="请输入产品价格" autocomplete="off" class="layui-input">
			</div>
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">产品信息</label>
		<div class="layui-input-block">
			<textarea style="height: 100px" name="info" lay-verify="required" placeholder="请输入产品信息" autocomplete="off" class="layui-input"></textarea>
		</div>
	</div>
	<div class="layui-form-item">
		<div class="layui-input-block">
			<button class="layui-btn" lay-submit lay-filter="form_manager_product">立即提交</button>
			<button type="reset" class="layui-btn layui-btn-primary">重置</button>
		</div>
	</div>
</form>
<script>
layui.use('upload', function(){
  var upload = layui.upload;
  var $=layui.$;
  //执行实例
  var uploadInst = upload.render({
    elem: '#test1' //绑定元素
    ,url: 'manager/product/uploadFile' //上传接口
    ,field:'multipartFile'
    ,acceptMinme:'images'
    ,accept:'image/*'
    ,done: function(res){
      //上传完毕回调
      $('#demo1').attr('src',res.data);
      $('#photo').val(res.data);
    }
    ,error: function(){
      //请求异常回调
    }
  });
});
</script>
